import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Cart from '../views/Cart.vue'
import Kind from '../views/Kind.vue'
import My from '../views/My.vue'
import Detail from '../components/Home/Detail.vue'
import Error from '../views/Error.vue'
import Search from '../components/Home/Search.vue'
import Login from '../components/Home/Login.vue'
import Reg3 from '../components/Home/Reg3.vue'
import Reg1 from '../components/Home/Reg1.vue'
import Reg2 from '../components/Home/Reg2.vue'
import Register from '../components/Home/Register.vue'
import Footer from '../components/Footer/Footer.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'   //重新定向
  },
  {
    path: '/home',
    name: 'Home',
    components: {
      default: Home,
      Footer
    }
  },
  {
    path: '/kind',
    name: 'Kind',
    components: {
      default: Kind,
      Footer
    }
  },
  {
    path: '/cart',
    name: 'Cart',
    components: {
      default: Cart,
      Footer
    }
  },
  {
    path: '/my',
    name: 'My',
    components: {
      default: My,
      Footer
    }
  },
  {
    path: '/detail/:proid',
    name: 'Detail',
    component: Detail,
  },
  {
    path: '/login',
    name: 'Login',
    component: Login,
  },
  {
    path: '/register',
    name: 'Register',
    redirect:'/register/one',
    component: Register,
    children: [
      {
        path: '/register/one',
        name: 'Reg1',
        component: Reg1,
      },
      {
        path: '/register/two',
        name: 'Reg2',
        component: Reg2,
      },
      {
        path: '/register/three',
        name: 'Reg3',
        component: Reg3,
      },
    ]
  },
  {
    path: '/search',
    name: 'Search',
    component: Search,
  },
  {
    path: '*',       //非
    name: 'Error',
    component: Error,
  },
]

const router = new VueRouter({
  routes
})

export default router
